﻿/************************************************************************     
 * 类名  :  WidgetExtension
 * 描述  :  
 * 版本  :  v1.0         
 * 用户  :  wangxinlu  
 * 时间  :  2/22/2016 6:50:11 AM    
************************************************************************  
 * Copyright @ wh 2016 . All rights reserved.  
************************************************************************/    

///<reference path="Widget.ts"/>
namespace wh.ui{

    export class WidgetExtension {

        private static extensionMap: Map<string, Widget> = new Map<string, Widget>();

        private static templateMap: Map<string, string> = new Map<string, string>();

        public static registerWidgetByType(widgetType: string, widget: any, template: string) {
            this.extensionMap.set(widgetType, widget);
            this.templateMap.set(widgetType, template);
        }

        public static findWidgetByType(widgetType: string): any {
            return this.extensionMap.get(widgetType);
        }

        public static findTemplateByType(widgetType: string): string {
            return this.templateMap.get(widgetType);
        }

        public static getExtensionMap(): Map<string, Widget> {
            return this.extensionMap;
        }
    }
}